home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group00a.txt / 000062_icon-group-sender _Wed Apr 12 10:26:43 2000.msg < prev    next >
Internet Message Format  |  2001-01-03  |  2KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.9.1a/8.9.1) id KAA07719
  4.     for icon-group-addresses; Wed, 12 Apr 2000 10:26:25 -0700 (MST)
  5. Message-Id: <200004121726.KAA07719@baskerville.CS.Arizona.EDU>
  6. Date: Wed, 12 Apr 2000 09:40:48 -0700
  7. From: Steve Wampler <swampler@noao.edu>
  8. X-Accept-Language: en
  9. To: Taybin Rutkin <trutkin@black.clarku.edu>,
  10.         icon-group <icon-group@optima.CS.Arizona.EDU>
  11. Subject: Re: Idol function pointers
  12. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  13. Status: RO
  14.  
  15. Taybin Rutkin wrote:
  16. > I hope this is the right forum to discuss Idol...
  17. > How would I pass a method as a variable?  I'm trying to create an event
  18. > system.  The call I'm using is
  19. > edges$watch(vertices$E_Update)
  20. > watch is the function that links the method to a list of procedures.  I'm
  21. > trying to call a method in a specific object.  vertices is the instance
  22. > and E_Update is the method that should be called at a later date.  The
  23. > code works fine if I use a regular procedure.  I poked through the Icon
  24. > output but the code it generated for that line was:
  25. > edges.__m.watch(edges,vertices.__m.E_Update(vertices))
  26. > I mostly understand that line, so I guess I need a way to remove the
  27. > vertices arguement at the end.
  28. > Any hints?
  29.  
  30. Taybin - in many OO languages, including Idol (and Java...), you cannot
  31. disassociate a method from its class in the way you'd like.  Pass the
  32. class down and invoke the method within the procedure.  Note that this
  33. imposes some discipline on how you write the code.  In Java, you'd use
  34. an interface to enforce the discipline; in Idol, you'll have to rely
  35. on self-discipline.
  36.  
  37. --
  38. Steve Wampler-  SOLIS Project, National Solar Observatory
  39. swampler@noao.edu
  40.